package xyz.scootaloo.mono.base.service.async

import org.springframework.context.annotation.Bean
import org.springframework.scheduling.annotation.EnableAsync
import org.springframework.stereotype.Component
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
import java.util.concurrent.ScheduledExecutorService

/**
 * @author flutterdash@qq.com
 * @since 2021/9/8 23:11
 */
@EnableAsync
@Component
class AsyncExecutorProviderConfig {

    @Bean("monoSingleTaskScheduler")
    fun logTask(): ExecutorService = Executors.newSingleThreadExecutor()

    @Bean("monoMutableTaskScheduler")
    fun delayTask(): ScheduledExecutorService = Executors.newScheduledThreadPool(3)

}
